<template>
  <el-dialog title="导入明细" :visible="showDialog" :before-close="cancel">
    <el-form :model="form" label-width="0">
      <el-form-item label="">
        <el-row>
          <el-col :span="18">
            <el-upload
              ref="upload"
              action="https://jsonplaceholder.typicode.com/posts/"
              :on-preview="handlePreview"
              :on-remove="handleRemove"
              :before-remove="beforeRemove"
              multiple
              :auto-upload="false"
              :limit="3"
              :on-exceed="handleExceed"
              :file-list="fileList">
              <el-button size="small" type="primary">点击上传</el-button>
              <div slot="tip" class="el-upload__tip">仅支持csv、xls、xlsx 文件，且文件大小不得超过5M</div>
            </el-upload>
          </el-col>
          <el-col :span="6">
            <a href="">下载模板</a>
          </el-col>
        </el-row>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="onSave">导 入</el-button>
      <el-button @click="cancel">取 消</el-button>
      
    </div>
  </el-dialog>
</template>

<script>
  export default {
    props: ['showDialog'],
    data () {
      return {
        form: {
          name: '',
          region: ''
        },
        fileList: []
      }
    },
    methods: {
      cancel () {
        this.$emit('close')
      },
      onSave () {
        this.$refs.upload.submit()
        this.$emit('save')
      },
      handlePreview () {

      },
      handleRemove () {

      },
      beforeRemove () {

      },
      handleExceed () {

      }
    },
    mounted () {
    }
  }
</script>

<style lang="scss">
  .upload {
    display: flex;
    justify-content: space-between;
  }
</style>
